package com.yunzheng.exception;

import com.yunzheng.enums.ResultStatuesEnums;

/**
 * <p>
 * 业务逻辑异常，如用户不存在
 * </p>
 *
 * @author 郭思良
 * @create 2020-07-23 15:38
 */
public class ServiceException extends RuntimeException {

    private String logInfo;

    private ResultStatuesEnums errorEnum;

    public ServiceException(ResultStatuesEnums message) {
        super(message.getMessage());
        errorEnum = message;
    }

    public ServiceException(ResultStatuesEnums errorEnum, String message) {
        super(message);
        this.errorEnum = errorEnum;
    }

    public ServiceException() {
        super();
    }

    public ServiceException(String message) {
        super(message);
    }

    public ServiceException(String message, Object causeBy) {
        super(message);
        this.logInfo = message + " - " + causeBy.toString();
    }

    public ServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    public ServiceException(Throwable cause) {
        super(cause);
    }

    protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public String getLogInfo() {
        return logInfo;
    }

    public ResultStatuesEnums getErrorEnum() {
        return errorEnum;
    }
}
